<?php

namespace App\Models\Access\User\Traits\Relationship;

use App\Models\Access\User\SocialLogin;

/**
 * Class UserRelationship
 * @package App\Models\Access\User\Traits\Relationship
 */
trait UserRelationship
{

    /**
     * Many-to-Many relations with Role.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function roles()
    {
        return $this->belongsToMany('App\Models\Access\Role\Role','assigned_roles','user_id','role_id');
    }

    /**
     * Many-to-Many relations with Ogz.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function ogzs()
    {
        return $this->belongsToMany('App\Models\Ogz','assigned_ogzs','user_id','ogz_id');
    }
    /**
     * one-to-one relations with user_relate.
     *
     * @return \Illuminate\Database\Eloquent\Relations\hasOne
     */
    public function relation()
    {
        return $this->belongsToMany('App\Models\Access\User\User','user_relate','internal_uid','external_uid');
    }
    /**
     * one-to-many relations with orders.
     *
     * @return \Illuminate\Database\Eloquent\Relations\hasMany
     */
    public function orders()
    {
        return $this->belongsToMany('App\Models\Orders\Order');
    }
}